var allChapters : Chapter[] = [
    {name: "Al-Fatiha", verses: 6 + 1},
    {name: "Al-Baqara", verses: 286 + 1},
    {name: "Al Imran", verses: 200 + 1},
    {name: "An-Nisa", verses: 176 + 1},
    {name: "Al-Maida", verses: 120 + 1},
    {name: "Al-Anam", verses: 165 + 1},
    {name: "Al-Araf", verses: 206 + 1},
    {name: "Al-Anfal", verses: 75 + 1},
    {name: "At-Tawba", verses: 128 + 1},
    {name: "Yunus", verses: 109 + 1},
    {name: "Hud", verses: 123 + 1},
    {name: "Yusuf", verses: 111 + 1},
    {name: "Ar-Rad", verses: 43 + 1},
    {name: "Ibrahim", verses: 52 + 1},
    {name: "Al-Hijr", verses: 99 + 1},
    {name: "An-Nahl", verses: 128 + 1},
    {name: "Al-Isra", verses: 111 + 1},
    {name: "Al-Kahf", verses: 110 + 1},
    {name: "Maryam", verses: 98 + 1},
    {name: "Ta-Ha", verses: 135 + 1},
    {name: "Al-Anbiya", verses: 112 + 1},
    {name: "Al-Hajj", verses: 78 + 1},
    {name: "Al-Muminoon", verses: 118 + 1},
    {name: "An-Nur", verses: 64 + 1},
    {name: "Al-Furqan", verses: 77 + 1},
    {name: "Ash-Shuara", verses: 227 + 1},
    {name: "An-Naml", verses: 93 + 1},
    {name: "Al-Qasas", verses: 88 + 1},
    {name: "Al-Ankabut", verses: 69 + 1},
    {name: "Ar-Rum", verses: 60 + 1},
    {name: "Luqman", verses: 34 + 1},
    {name: "As-Sajda", verses: 30 + 1},
    {name: "Al-Ahzab", verses: 73 + 1},
    {name: "Saba", verses: 54 + 1},
    {name: "Fatir (Al-Malaikah)", verses: 45 + 1},
    {name: "Ya Sin", verses: 83 + 1},
    {name: "As-Saaffat", verses: 182 + 1},
    {name: "Sad", verses: 88 + 1},
    {name: "Az-Zumar", verses: 75 + 1},
    {name: "Ghafir", verses: 85 + 1},
    {name: "Fussilat", verses: 54 + 1},
    {name: "Ash-Shura", verses: 53 + 1},
    {name: "Az-Zukhruf", verses: 89 + 1},
    {name: "Ad-Dukhan", verses: 59 + 1},
    {name: "Al-Jathiya", verses: 37 + 1},
    {name: "Al-Ahqaf", verses: 35 + 1},
    {name: "Muhammad", verses: 38 + 1},
    {name: "Al-Fath", verses: 29 + 1},
    {name: "Al-Hujurat", verses: 18 + 1},
    {name: "Qaf", verses: 45 + 1},
    {name: "Adh-Dhariyat", verses: 60 + 1},
    {name: "At-Tur", verses: 49 + 1},
    {name: "An-Najm", verses: 62 + 1},
    {name: "Al-Qamar", verses: 55 + 1},
    {name: "Ar-Rahman", verses: 78 + 1},
    {name: "Al-Waqia", verses: 96 + 1},
    {name: "Al-Hadid", verses: 29 + 1},
    {name: "Al-Mujadila", verses: 22 + 1},
    {name: "Al-Hashr", verses: 24 + 1},
    {name: "Al-Mumtahina", verses: 13 + 1},
    {name: "As-Saff", verses: 14 + 1},
    {name: "Al-Jumua", verses: 11 + 1},
    {name: "Al-Munafiqun", verses: 11 + 1},
    {name: "At-Taghabun", verses: 18 + 1},
    {name: "At-Talaq", verses: 12 + 1},
    {name: "At-Tahrim", verses: 12 + 1},
    {name: "Al-Mulk", verses: 30 + 1},
    {name: "Al-Qalam", verses: 52 + 1},
    {name: "Al-Haaqqa", verses: 52 + 1},
    {name: "Al-Maarij", verses: 44 + 1},
    {name: "Nuh", verses: 28 + 1},
    {name: "Al-Jinn", verses: 28 + 1},
    {name: "Al-Muzzammil", verses: 20 + 1},
    {name: "Al-Muddathir", verses: 56 + 1},
    {name: "Al-Qiyama", verses: 40 + 1},
    {name: "Al-Insan (al-Dahr)", verses: 31 + 1},
    {name: "Al-Mursalat", verses: 50 + 1},
    {name: "An-Naba", verses: 40 + 1},
    {name: "An-Naziat", verses: 46 + 1},
    {name: "Abasa", verses: 42 + 1},
    {name: "At-Takwir", verses: 29 + 1},
    {name: "Al-Infitar", verses: 19 + 1},
    {name: "Al-Mutaffifin", verses: 36 + 1},
    {name: "Al-Inshiqaq", verses: 25 + 1},
    {name: "Al-Burooj", verses: 22 + 1},
    {name: "At-Tariq", verses: 17 + 1},
    {name: "Al-Ala", verses: 19 + 1},
    {name: "Al-Ghashiya", verses: 26 + 1},
    {name: "Al-Fajr", verses: 30 + 1},
    {name: "Al-Balad", verses: 20 + 1},
    {name: "Ash-Shams", verses: 15 + 1},
    {name: "Al-Lail", verses: 21 + 1},
    {name: "Ad-Dhuha", verses: 11 + 1},
    {name: "Al-Inshirah", verses: 8 + 1},
    {name: "At-Tin", verses: 8 + 1},
    {name: "Al-Alaq", verses: 19 + 1},
    {name: "Al-Qadr", verses: 5 + 1},
    {name: "Al-Bayyina", verses: 8 + 1},
    {name: "Az-Zalzala", verses: 8 + 1},
    {name: "Al-Adiyat", verses: 11 + 1},
    {name: "Al-Qaria", verses: 11 + 1},
    {name: "At-Takathur", verses: 8 + 1},
    {name: "Al-Asr", verses: 3 + 1},
    {name: "Al-Humaza", verses: 9 + 1},
    {name: "Al-Fil", verses: 5 + 1},
    {name: "Quraysh", verses: 4 + 1},
    {name: "Al-Maun", verses: 7 + 1},
    {name: "Al-Kawthar", verses: 3 + 1},
    {name: "Al-Kafirun", verses: 6 + 1},
    {name: "An-Nasr", verses: 3 + 1},
    {name: "Al-Masadd", verses: 5 + 1},
    {name: "Al-Ikhlas", verses: 4 + 1},
    {name: "Al-Falaq", verses: 5 + 1},
    {name: "Al-Nas", verses: 6 + 1}

];


class Verse {
    public tags : Tag[];
    constructor(public verseNumber : number, public chapter : Chapter) { }
}

class VersewiseUser {
    public name : string;
}

class TagComment {
    public text : string;
    public author : VersewiseUser;
}
class Tag {
    public verse : Verse;
    public coments : TagComment[];
}

class Chapter {
    constructor(public name : string, public verses : number) {

    }
}

class VersewiseScope {
    public allChapters : Chapter[];
    public allVerses : Verse[];
}

class VersewiseCtrl {
    constructor(public $scope : VersewiseScope) {
        $scope.allChapters = allChapters;
        $scope.allVerses = [];

        for (var i = 0; i < allChapters.length; i++) {
            var chapter = allChapters[i];
            for (var j = 0; j < chapter.verses; j++) {
                $scope.allVerses.push(
                    {
                        chapter: chapter,
                        verseNumber: j + 1,
                        tags: []
                    }
                );
            }
        }
    }

    public versesView() : Verse[] {
        alert("123");
        return this.$scope.allVerses.slice(0, 20);
    }
}


/****** Init App *******/
var angular = eval("angular"); //Hack to get rid of "angular undefined error"
var versewise = angular.module('versewise', []);
versewise.controller('VersewiseCtrl', ['$scope', VersewiseCtrl]);
